﻿using AnyLink.Domain.Enums;
using Newtonsoft.Json;
using SqlSugar;

namespace AnyLink.Domain.Entities.System
{
    /// <summary>
    /// 角色信息表
    /// </summary>
    [SugarTable("sys_role", TableDescription = "角色信息表", IsDisabledUpdateAll = true)]
    public class SysRole : BaseAuditedEntity<long>
    {
        /// <summary>
        /// 角色ID
        /// </summary>
        [SugarColumn(ColumnName = "role_id", IsPrimaryKey = true, ColumnDescription = "角色ID")]
        [JsonProperty(propertyName: "roleId")]
        public override long Id { get; set; }

        /// <summary>
        /// 角色名称
        /// </summary>
        [SugarColumn(ColumnName = "role_name", ColumnDataType = "VARCHAR(30)", ColumnDescription = "角色名称", IsNullable = true)]
        public string RoleName { get; set; }

        /// <summary>
        /// 角色权限字符串
        /// </summary>
        [SugarColumn(ColumnName = "role_key", ColumnDataType = "VARCHAR(100)", ColumnDescription = "角色权限字符串", IsNullable = true)]
        public string RoleKey { get; set; }

        /// <summary>
        /// 显示顺序
        /// </summary>
        [SugarColumn(ColumnName = "role_sort", ColumnDescription = "显示顺序", IsNullable = true)]
        public int RoleSort { get; set; }

        /// <summary>
        /// 数据范围（1：全部数据权限 2：自定数据权限 3：本部门数据权限 4：本部门及以下数据权限）
        /// </summary>
        [SugarColumn(ColumnName = "data_scope", ColumnDescription = "数据范围（1：全部数据权限 2：自定数据权限 3：本部门数据权限 4：本部门及以下数据权限）", IsNullable = true, DefaultValue = "1")]
        public DataScopeEnum DataScope { get; set; }

        /// <summary>
        /// 角色状态（0正常 1停用）
        /// </summary>
        [SugarColumn(ColumnName = "status", ColumnDescription = "角色状态（0正常 1停用）", IsNullable = true, DefaultValue = "0")]
        public StatusEnum Status { get; set; }

        /// <summary>
        /// 删除标志（0代表存在 2代表删除）
        /// </summary>
        [SugarColumn(ColumnName = "del_flag", ColumnDescription = "删除标志（0代表存在 2代表删除）", IsNullable = true, DefaultValue = "0")]
        public DelFlagEnum DelFlag { get; set; }
        

        /// <summary>
        /// 备注
        /// </summary>
        [SugarColumn(ColumnName = "remark", ColumnDataType = "VARCHAR(500)", ColumnDescription = "备注", IsNullable = true)]
        public string Remark { get; set; }
    }
}
